This project demonstrates how to set up a simple animation. If you are new to SpriteWorld, and find that even this demo is too complex for you, open the folder called "Want something easier?"; it contains a stripped-down version that should be easier to understand.
Try modifying this demo with some of the following options:
1) Set kInterlacedMode to true, and you will see what the animation looks like in interlaced (or "draw every-other-line") mode. It will also go a bit faster, which could be useful for those with slower computers. Using interlaced mode won't speed up non-scrolling animations such as the Simple demo as much as it will speed up scrolling animations, since in scrolling animations, the majority of the time is spent copying everything to the screen, which is why skipping every other line can make it go nearly twice as fast. However, interlacing may help even in non-scrolling animations if you need those extra fps on a slower computer.
2) Set kSyncToVBL to true to sync the animation to the monitor's refresh rate, making things look smoother. This may slow down the animation somewhat, since SpriteWorld has to wait for the VBL interrupt before drawing to the screen each frame. When syncing to the VBL, you should also set kMaxFPS to 0, or the animation may go even slower than normal, since it has to wait for both the VBL interrupt and the kMaxFPS delay. [Note: With 2.1, kSyncToVBL is set to true by default.]
3) Set kWorldRectInset to a non-zero value (such as 50) to see what it looks like when the SpriteWorld is smaller than its source window. This feature could be useful if you wanted a window that covers the screen on any size monitor, but you don't necessarily want the SpriteWorld to fill the entire window. Also, try doing a search for SWBounceSprite, to find the following two lines:
SWBounceSprite(ballSpriteP);
//SWWrapSprite(ballSpriteP);
Comment out the first line and uncomment the second line, and run the program. This will demonstrate how SpriteWorlds with custom world rects still have proper clipping of sprites.
4) Turn off kUseShadows if the animation runs slowly. The ShadowSpriteDrawProc uses QuickDraw to draw a translucent region, which is quite a bit slower than a custom blitter would be. Brian's translucency blitter would be much faster, although the QuickDraw method has the advantage of being able to use the same source Sprite. To use Brian's method, you'd have to create a pure-black Sprite, and then draw this at some level of translucency to get the same effect.